﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SoftKeyBoard
{
    public class Checkout
    {
        private static string CNHZRegexString = @"(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)";
        private static string HZRegexString = @"(^(14|15)\d{7})|(^[DEGPS]\d{7,8}$)";
        private static string GAZRegexString = @"^[a-zA-Z0-9]{6,10}$";
        private static string TWZRegexString = @"^[a-zA-Z][0-9]{9}$";

        private static bool IsMatch(string source, string RegexString)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(source, RegexString);
        }
        /// <summary>
        /// 判断是不是中国护照号码
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public static bool IsChinesePassPortNumber(string number)
        {
            return IsMatch(number, CNHZRegexString);
        }

        /// <summary>
        /// 判断是不是港澳证号码
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public static bool IsGAZNumber(string number)
        {
            return IsMatch(number, GAZRegexString);
        }

        /// <summary>
        /// 判断是不是大陆证号码
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public static bool IsTWZNumber(string number)
        {
            return IsMatch(number, TWZRegexString);
        }
    }
}
